package cn.tedu.csmall.admin.webapi.mapper;

import cn.tedu.csmall.admin.pojo.entity.AdminDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.jdbc.Sql;
import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
public class AdminAddNewMapper {
    @Autowired
    AdminMapper mapper;

    @Test
    @Sql("classpath:truncate.sql")
    public void testInsert(){
        AdminDTO adminDTO = new AdminDTO();
        adminDTO.setUsername("测试管理员001");
        assertDoesNotThrow(()->{
            int rows = mapper.insert(adminDTO);
            assertEquals(1,rows);
            assertEquals(8,adminDTO.getId());
        });
    }
}
